Page({
  data:{
    num:7
  },  
  handleNumber(num){
    var res = [];
    for(var i = 0 ; i < 5 ; i++){
      if(num>=2){
        res.push(2);
      }else if(num>0){
        res.push(parseFloat(num.toFixed(1)));
      }else{
        res.push(0);
      }
      num -= 2;
    }
    return res;
  },
  onLoad(){
    var num = this.data.num;
    var stars = this.handleNumber(num);
    this.setData({stars});
  },
  onTap(){
    wx.navigateTo({
      url: "/pages/movie/movie?id=1001",
    })
  }
})

